
<template>
  <div class="add-supervision-information-container">
    <div>
      <div class="my-form" style="width: 100%; border-radius: 4px; margin: 0">
        <div class="my-form-item">
          <div class="my-form-item-label">上课日期</div>
          <div class="my-form-item-content">
            <div>
              <el-date-picker v-model="value1" type="date" style="width: 161px" placeholder="选择日期"
                @change="changeTearInfo">
              </el-date-picker>
            </div>
            <div style="
                border-left: 1px solid rgba(0, 76, 167, 0.39);
                border-right: 1px solid rgba(0, 76, 167, 0.39);
              ">
              上课教员
            </div>
            <div>
              <span>
                <el-select v-model="skjyName" style="width: 120px; margin-left: 30px" clearable placeholder="请选择"
                  @change="changeTearInfo">
                  <el-option v-for="(item, index) in teacherList" :key="index" :label="item.xm" :value="index">
                  </el-option>
                </el-select>
              </span>
              <span style="
                  background: #fff6ef;
                  border: 1px solid #f3b815;
                  color: #f3b815;
                  padding: 3px 8px;
                  border-radius: 4px;
                  margin-left: 15px;
                  cursor: pointer;
                " @click="clickInputT">
                <img style="position: relative; top: 2px" src="../../../assets/appraisal/icon-manual-entry.png"
                  alt="" />
                <span style="margin-left: 5px">手动录入</span>
              </span>
            </div>
            <!-- </div> -->
            <div style="
                border-left: 1px solid rgba(0, 76, 167, 0.39);
                border-right: 1px solid rgba(0, 76, 167, 0.39);
              ">
              听查课人
            </div>
            <span v-if="this.userId == '110520'">
              <el-input style="
                  margin-left: 30px;
                  margin-top: -18px;
                  width: 120px;
                  border: 1px solid #004ca7;
                  color: #004ca7;
                  border-radius: 4px;
                  border: none;
                " v-model="userName" disabled>
              </el-input>
              <!-- <InputItem
                 disabled
                 :value="userName"
                 @input="
                (e) => {
                 userName = e;
                }
                "
              ></InputItem> -->
            </span>
            <span v-else>
              <el-input style="
                  margin-left: 70px;
                  margin-top: -18px;
                  width: 120px;
                  border: 1px solid #004ca7;
                  color: #004ca7;
                  border-radius: 4px;
                  border: none;
                " v-model="userName" disabled>
              </el-input>
            </span>
          </div>
        </div>
        <div class="my-form-item">
          <div class="my-form-item-label">上课信息</div>
          <div class="my-form-item-content">
            <div v-if="!tableData || !tableData.length"></div>
            <div v-else v-for="(item, index) in tableData" :key="index">
              <span v-show="!isManual">
                <el-radio v-model="baseInfo" :label="index + 1" @change="
                  (e) => {
                    handleCheckAllChange(e, item);
                  }
                "></el-radio>
                <!-- <el-checkbox
                    
                    v-model="item.baseInfo"
                    @change="
                      (e) => {
                        handleCheckAllChange(e, item);
                      }
                    "
                  ></el-checkbox> -->
              </span>
              <span>课程名称： <span>{{ item.coursename }}</span></span>
              <span>
                听课节次：
                <span v-if="!isManual">
                  <el-input v-model="item.empltkjs" style="width: 100px" size="small" type="number" min="1" max="10">
                  </el-input>
                  &nbsp; -&nbsp;
                  <el-input v-model="item.empltkjs1" style="width: 100px" size="small" type="number" min="1" max="10">
                  </el-input>
                </span>
                <span v-else> {{ item.empltkjs }} - {{ item.empltkjs1 }} </span>
              </span>
              <!-- <span>上课教员： <span>{{ item.employee }}</span></span> -->
              <!-- <span>上课节次： <span>{{ item.empltkjs }}</span></span> -->
              <span>教学班： <span>{{ item.classes }}</span></span>
              <span>场地：<span>{{ item.courseplace }}</span></span>
            </div>
          </div>
        </div>
        <div class="my-form-item">
          <div class="my-form-item-label">评价标准</div>

          <div class="my-form-item-content" :class="[titles.length % 2 == 0 ? 'LastItem' : '']">
            <ul>
              <li style="height: 55px">
                <span v-for="(title, index) in titles" :key="index" :style="{
                  width:
                    index == 0
                      ? '471px'
                      : Math.ceil(946 / (titles.length - 1)) + 'px',
                }">{{ title }}</span>
              </li>
              <template v-for="(data, index) in subTitleser">
                <li style="height: 55px" :key="index + 33">
                  <span style="width: 471px">{{ data.zbxmc }}</span>
                  <span v-for="num in titles.length - 1" :key="num" :style="{
                    width: Math.ceil(946 / (titles.length - 1)) + 'px',
                  }"></span>
                </li>
                <li style="height: 55px" v-for="(item, index) in data.evaluateBatchNormList" :key="index + 100">
                  <span style="width: 471px">{{ item.zbxmc }} </span>
                  <span v-for="num in titles.length - 1" :key="num" :style="{
                    width: Math.ceil(946 / (titles.length - 1)) + 'px',
                  }">
                    
                    <el-checkbox v-model="item['checked' + num]" @change="sssa(item, num)"></el-checkbox>
                  </span>
                </li>
              </template>
            </ul>
          </div>
        </div>
        <div class="my-form-item">
          <div class="my-form-item-label">评价等级</div>
          <div class="my-form-item-content">
            <div>
              <el-select size="mini" class="evaluate-level" style="width: 89px" v-model="evaluation_grade"
                @change="selectChanged" popper-class="add-supervision-information-green-popper">
                <el-option v-for="(item, index) in evaluation_grades" :key="index" :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </div>
            <div>评定分数</div>
            <!-- <el-form :rules="rules" ref="ruleForm" v-if="evaluation_grade == '优'">
              <el-form-item style="height:-20px"  prop="name">
              <el-input style="width: 110px"
                v-model.number="evaluation_score"></el-input>
              </el-form-item>
            </el-form>
            <el-form :rules="rules" ref="ruleForm" v-if="evaluation_grade == '良'">
              <el-form-item style="height:-20px"  prop="namea">
              <el-input style="width: 110px"
                v-model.number="evaluation_score"></el-input>
              </el-form-item>
            </el-form>
            <el-form :rules="rules" ref="ruleForm" v-if="evaluation_grade == '中'">
              <el-form-item style="height:-20px"  prop="names">
              <el-input style="width: 110px"
                v-model.number="evaluation_score"></el-input>
              </el-form-item>
            </el-form>
            <el-form :rules="rules" ref="ruleForm" v-if="evaluation_grade == '差'">
              <el-form-item style="height:-20px"  prop="named">
              <el-input style="width: 110px"
                v-model.number="evaluation_score"></el-input>
              </el-form-item>
            </el-form> -->
            <!-- <div>
              <el-input
                style="width: 110px"
                v-model="evaluation_score"
              ></el-input>
            </div> -->
            <el-input v-model="num" type="number" @change="handleChange" :min="minx" :max="maxx" style="width: 120px">
            </el-input>
          </div>
        </div>
        <div class="my-form-item">
          <div class="my-form-item-label">专家评语</div>
          <div class="my-form-item-content">
            <div>
              <el-input type="textarea" :rows="4" style="width: 458px" v-model="expert_reviews"></el-input>
            </div>
            <div>评语扫描件</div>
            <div>
              <el-upload class="upload-demo" ref="upload" action="https://jsonplaceholder.typicode.com/posts/"
                :file-list="fileList" :on-change="getFile" :auto-upload="false" :on-exceed="handleExceed"
                style="width: 280px" :limit="1">
                <el-button slot="trigger" style="
                    width: 90px;
                    height: 30px;
                    border: 1px solid #5230e9;
                    border-radius: 6px;
                    color: #5230e9;
                    background: #efebff;
                  " size="small" type="primary">选择文件</el-button><span style="color: red">（最大允许上传个数为1）</span>
              </el-upload>
              <!-- <span>评语扫描件</span> -->
            </div>
          </div>
        </div>
      </div>
      <div class="button-group">
        <div @click="saveGrouper(1)">提 交</div>
        <div @click="saveGrouper(2)">保 存</div>
        <div @click="cback">取 消</div>
        <!-- <div @click="
          $router.push({
            path: '/admin/appraisal/manage',
          })
        ">
          取 消
        </div> -->
      </div>
    </div>
    <el-dialog title="手动录入填写上课信息" :visible.sync="showManualEntryDialog" width="1185px" class="manual-entry-container">
      <div>
        <el-row>
          <el-col :span="12">
            <div>课程名称</div>
            <div>
              <el-input v-model="inputInfo.classesname" style="width: 234px" placeholder="请输入课程名称"></el-input>
            </div>
          </el-col>
          <el-col :span="12">
            <div>上课教员</div>
            <div>
              <el-autocomplete style="width: 234px" v-model="inputInfo.teachername"
                :fetch-suggestions="querySearchAsync" placeholder="请输入上课教员" :trigger-on-focus="false"
                @select="handleSelect"></el-autocomplete>
              <!-- <el-input v-model="inputInfo.teachername" style="width: 234px"></el-input> -->
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <div>听课节次</div>
            <div>
              <el-input v-model="inputInfo.listenclass" style="width: 108px" type="number" size="small" min="1"
                max="10"></el-input>
              &nbsp; -&nbsp;
              <el-input v-model="inputInfo.listenclassTwo" style="width: 108px" size="small" type="number" min="1"
                max="10"></el-input>
            </div>
          </el-col>
          <el-col :span="12">
            <div>教学班</div>
            <div>
              <el-input placeholder="请输入教学班" v-model="inputInfo.classes" style="width: 234px"></el-input>
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <div>场 地</div>
            <div>
              <el-input placeholder="请输入场地" v-model="inputInfo.place" style="width: 234px"></el-input>
            </div>
          </el-col>
          <el-col :span="12">
            <div></div>
            <div></div>
          </el-col>
        </el-row>
      </div>
      <span slot="footer" class="dialog-footer">
        <button @click="supervisionadd">保存</button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import {
  userSaves,
  srcAbcd,
  saveGroup,
  selectPaike,
} from "@/api/teacher/admin";
import { addcourse, supervisionlist } from "@/api/teacher/supervision";
import InputItem from "../../../components/InputItem.vue";
import { TypeAdminId } from "@/api/userIdType";
import { teacherinfoSelectAll } from "../../../api/evaluation/setActivityEvaluations";
import {
  reqAddnewTraining,
  getUploadTrain,
} from "@/api/propositionReview/approval";
export default {
  components: {
    InputItem,
  },
  name: "addsupervisioninformation",
  data() {
    // var checkAge = (rule, value, callback) => {
    //   console.log(value,"ssssssssssssssssssss")
    //   if (!value) {
    //     return callback(new Error('年龄不能为空'));
    //   }
    //   setTimeout(() => {
    //     if (!Number.isInteger(value)) {
    //       callback(new Error('请输入数字值'));
    //     } else {
    //       if (value < 18) {
    //         callback(new Error('必须年满18岁'));
    //       } else {
    //         callback();
    //       }
    //     }
    //   }, 1000);
    // };
    return {
      skjyzjh: "",
      tckrzjh: "",
      state: "",
      baseInfo: "",
      teacherList: [],
      teacherId: "",
      userId: "",
      skxx: {},
      userName: "",
      tableData: [],
      pcid: "",
      teaName: "",
      titles: [],

      subTitleser: [],
      checkboxList1: [],
      checkboxList2: [],
      checked: false,
      value1: new Date(),
      expert_reviews: "",
      evaluation_score: "",
      evaluation_grade: "A",
      evaluation_grades: [
        { label: "A", value: "A" },
        { label: "B", value: "B" },
        { label: "C", value: "C" },
        { label: "D", value: "D" },
      ],
      class_sessions: "",
      class_sessions_list: [],
      showManualEntryDialog: false,
      //录入信息
      inputInfo: {
        classesname: "",
        teachername: "",
        classes: "",
        place: "",
        listenclass: "",
        listenclassTwo: "",
      },
      rules: {
        // name: [
        //   {validator: checkAge, trigger: 'blur' }
        // ],
        // namea: [
        //   { validator: checkAge, message: '长度在 3 到 5 个字符', trigger: 'blur' }
        // ],
        //  names: [
        //   { required: true, message: '请输入70-79分以内分数！', trigger: 'blur' },
        //   { validator: checkAge, message: '长度在 3 到 5 个字符', trigger: 'blur' }
        // ],
        //  named: [
        //   { required: true, message: '请输入70分以下分数！', trigger: 'blur' },
        //   { validator: checkAge,  message: '长度在 3 到 5 个字符', trigger: 'blur' }
        // ]
      },
      restaurants: [],
      empltkjs: "",
      empltkjs1: "",
      fileName: "",
      skjyName: "",
      minx: "",
      maxx: "",
      num: "",
      isManual: false,
    };
  },
  created() {
    //获取所有教员信息
    teacherinfoSelectAll().then((res) => {
      if (res.data.code == 200) {
        console.log('评分信息1', res.data.data)
        this.teacherList = res.data.data;
      }
    });
    this.srcAbcdList();
    this.selectPaikeS(this.value1);
    this.studentsupid();
    this.userId = TypeAdminId();
    this.userSaves();
  },
  methods: {
    //文件限制传一个的提示
    handleExceed(files, fileList) {
      this.$message.warning(`当前限制选择 1 个文件`);
    },
    //评定分数失焦事件
    handleChange(value) {
      if (value == "") {
        this.$message({
          showClose: true,
          type: "warning",
          message: "评定分数不能为空！",
        });
        this.num = "";
        return;
      }
      if (localStorage.getItem("sekevalue") == "A") {
        if (value < 90) {
          this.$message({
            showClose: true,
            type: "warning",
            message: "请输入90-100的分数",
          });
          this.num = "";
        }
      }
      if (localStorage.getItem("sekevalue") == "B") {
        if (value < 80 || value > 90) {
          this.$message({
            showClose: true,
            type: "warning",
            message: "请输入80-90的分数",
          });
          this.num = "";
        }
      }
      if (localStorage.getItem("sekevalue") == "C") {
        if (value < 60 || value > 80) {
          this.$message({
            showClose: true,
            type: "warning",
            message: "请输入60-80的分数",
          });
          this.num = "";
        }
      }
      if (localStorage.getItem("sekevalue") == "D") {
        if (value < 1 || value > 60) {
          this.$message({
            showClose: true,
            type: "warning",
            message: "请输入1-60的分数",
          });
          this.num = "";
        }
      }
    },
    //评定等级选择事件
    selectChanged(value) {
      localStorage.setItem("sekevalue", value);
      if (value == "A") {
        this.minx = 90;
        this.maxx = 100;
      }
      if (value == "B") {
        this.minx = 80;
        this.maxx = 90;
      }
      if (value == "C") {
        this.minx = 60;
        this.maxx = 80;
      }
      if (value == "D") {
        this.minx = 1;
        this.maxx = 60;
      }
    },
    //教员选择事件
    changeTearInfo(index) {
      this.isManual = false;
      this.selectPaikeS(index);
    },
    //根据日期和教员id查询课程
    selectPaikeS(index) {
      let dateInfo = "";
      if (typeof index == "number") {
        this.skjyzjh = this.teacherList[index].zjhm;
        this.teacherId = this.teacherList[index].id;
        this.skjyName = this.teacherList[index].xm;
      } else if (typeof index == "object") {
        var y = this.value1.getFullYear();
        var m = this.value1.getMonth() + 1;
        m = m < 10 ? "0" + m : m;
        var d = this.value1.getDate();
        d = d < 10 ? "0" + d : d;
        dateInfo = y + "-" + m + "-" + d + " " + "00:00:00";
        this.value1 = dateInfo;
      }
      let paike = {
        coursedate: this.value1,
        courseper: index ? this.teacherId : "",
      };
      selectPaike(paike).then((res) => {
        if (res.data.code == 200) {
          this.tableData = res.data.data;
          this.tableData.forEach((ele) => {
            ele.coursename = ele.paikeInfo.coursename;
            ele.classes = ele.paikeInfo.majorclass;
            // ele.empltkjs = '';
            // ele.empltkjs1 = '';
          });
        }
      });
    },
    //上课信息单选按钮 it 获取当前行数据
    handleCheckAllChange(val, it) {
      this.skxx = it;
      console.log(this.skxx, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
      // var _this = this;
      // this.checking = true;
      // this.tableData.forEach((item) => {
      //   item[it + "select"] = val;
      // });
      // console.log(this.tableData)
      // //this.baseInfo[it + "isIndeterminate"] = false;
      // window.setTimeout(function () {
      //   _this.checking = false;
      // }, 500);
      // this.$forceUpdate();
    },
    //手动录入上课信息弹框出
    clickInputT() {
      this.showManualEntryDialog = true;
      this.restaurants = this.teacherList;
      this.restaurants.forEach((item) => {
        item.value = item.xm;
      });
    },
    //手动录入教员信息模糊查询
    querySearchAsync(queryString, cb) {
      var restaurants = this.restaurants;
      var results = queryString
        ? restaurants.filter(this.createStateFilter(queryString))
        : restaurants;
      this.teacherId = results.length > 0 ? results[0].id : "";
      this.skjyzjh = results.length > 0 ? results[0].zjhm : "";
      clearTimeout(this.timeout);
      this.timeout = setTimeout(() => {
        cb(results);
      }, 1000 * Math.random());
    },
    //过滤教员信息
    createStateFilter(queryString) {
      // let teachername = this.inputInfo.teachername;
      return (state) => {
        return (
          state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
        );
      };
    },
    //手动录入上课信息
    supervisionadd: function () {
      // this.tableData = [];
      let el = this;
      if (
        Number(el.inputInfo.listenclass) != "" &&
        Number(el.inputInfo.listenclassTwo != "")
      ) {
        if (
          Number(el.inputInfo.listenclass <= 0) ||
          Number(el.inputInfo.listenclassTwo <= 0)
        ) {
          this.$message({
            type: "error",
            message: "听课节次最小值为1！",
          });
          return;
        }
      }
      el.showManualEntryDialog = false;
      this.skjyName = el.inputInfo.teachername;
      let obj = {
        coursename: el.inputInfo.classesname,
        classes: el.inputInfo.classes,
        courseplace: el.inputInfo.place,
        empltkjs: el.inputInfo.listenclass,
        empltkjs1: el.inputInfo.listenclassTwo,
      };
      this.tableData.push(obj);
      console.log(this.tableData[0]);
      this.skxx.empltkjs = this.tableData[0].empltkjs;
      this.skxx.empltkjs1 = this.tableData[0].empltkjs1;
      this.isManual = true;
      // let obj = {
      //   classesname: el.inputInfo.classesname,
      //   teachername: el.inputInfo.teachername,
      //   classes: el.inputInfo.classes,
      //   place: el.inputInfo.place,
      //   listenclass: el.inputInfo.listenclass && el.inputInfo.listenclassTwo ? el.inputInfo.listenclass + '-' + el.inputInfo.listenclassTwo : ''
      // }
      // return new Promise(() => {
      //   addcourse(obj).then(res => {
      //     if(res.data.code == 200){
      //     }
      //   })
      // })
    },
    // sssa(item,index){
    //   for (let i = 0; i < this.subTitleser.length; i++) {
    //     for (
    //       let j = 0;
    //       j < this.subTitleser[i].evaluateBatchNormList.length;
    //       j++
    //     ) {
    //       if (this.subTitleser[i].evaluateBatchNormList[j].result == "A") {
    //         this.subTitleser[i].evaluateBatchNormList[j].checked1 = true;
    //         if (this.subTitleser[i].evaluateBatchNormList[j].checked2 == true) {
    //           this.subTitleser[i].evaluateBatchNormList[j].checked1 = false;
    //           this.subTitleser[i].evaluateBatchNormList[j].result = "B";
    //         } else if (
    //           this.subTitleser[i].evaluateBatchNormList[j].checked3 == true
    //         ) {
    //           this.subTitleser[i].evaluateBatchNormList[j].checked1 = false;
    //           this.subTitleser[i].evaluateBatchNormList[j].result = "C";
    //         } else if (
    //           this.subTitleser[i].evaluateBatchNormList[j].checked4 == true
    //         ) {
    //           this.subTitleser[i].evaluateBatchNormList[j].checked1 = false;
    //           this.subTitleser[i].evaluateBatchNormList[j].result = "D";
    //         }
    //       } else if (
    //         this.subTitleser[i].evaluateBatchNormList[j].result == "B"
    //       ) {
    //         this.subTitleser[i].evaluateBatchNormList[j].checked2 = true;
    //         if (this.subTitleser[i].evaluateBatchNormList[j].checked1 == true) {
    //           this.subTitleser[i].evaluateBatchNormList[j].checked2 = false;
    //           this.subTitleser[i].evaluateBatchNormList[j].result = "A";
    //         } else if (
    //           this.subTitleser[i].evaluateBatchNormList[j].checked3 == true
    //         ) {
    //           this.subTitleser[i].evaluateBatchNormList[j].checked2 = false;
    //           this.subTitleser[i].evaluateBatchNormList[j].result = "C";
    //         } else if (
    //           this.subTitleser[i].evaluateBatchNormList[j].checked4 == true
    //         ) {
    //           this.subTitleser[i].evaluateBatchNormList[j].checked2 = false;
    //           this.subTitleser[i].evaluateBatchNormList[j].result = "D";
    //         }
    //       } else if (
    //         this.subTitleser[i].evaluateBatchNormList[j].result == "C"
    //       ) {
    //         this.subTitleser[i].evaluateBatchNormList[j].checked3 = true;
    //         if (this.subTitleser[i].evaluateBatchNormList[j].checked1 == true) {
    //           this.subTitleser[i].evaluateBatchNormList[j].checked3 = false;
    //           this.subTitleser[i].evaluateBatchNormList[j].result = "A";
    //         } else if (
    //           this.subTitleser[i].evaluateBatchNormList[j].checked2 == true
    //         ) {
    //           this.subTitleser[i].evaluateBatchNormList[j].checked3 = false;
    //           this.subTitleser[i].evaluateBatchNormList[j].result = "B";
    //         } else if (
    //           this.subTitleser[i].evaluateBatchNormList[j].checked4 == true
    //         ) {
    //           this.subTitleser[i].evaluateBatchNormList[j].checked3 = false;
    //           this.subTitleser[i].evaluateBatchNormList[j].result = "D";
    //         }
    //       } else if (
    //         this.subTitleser[i].evaluateBatchNormList[j].result == "D"
    //       ) {
    //         this.subTitleser[i].evaluateBatchNormList[j].checked4 = true;
    //         if (this.subTitleser[i].evaluateBatchNormList[j].checked1 == true) {
    //           this.subTitleser[i].evaluateBatchNormList[j].checked4 = false;
    //           this.subTitleser[i].evaluateBatchNormList[j].result = "A";
    //         } else if (
    //           this.subTitleser[i].evaluateBatchNormList[j].checked2 == true
    //         ) {
    //           this.subTitleser[i].evaluateBatchNormList[j].checked4 = false;
    //           this.subTitleser[i].evaluateBatchNormList[j].result = "B";
    //         } else if (
    //           this.subTitleser[i].evaluateBatchNormList[j].checked3 == true
    //         ) {
    //           this.subTitleser[i].evaluateBatchNormList[j].checked4 = false;
    //           this.subTitleser[i].evaluateBatchNormList[j].result = "C";
    //         }
    //       }
    //     }
    //   }

    //   console.log(this.subTitleser)
    // },

    userSaves() {
      return new Promise((resolve) => {
        userSaves().then((res) => {
          console.log(res.data, "111111111112");
        });
      });
    },
    // 修改
    // 传入上课信息，督导信息 supervisionid
    studentsupid() {
      return new Promise(() => {
        //教员查询到所有数据
        srcAbcd().then((res) => {
          // console.log("=====================督导信息跳转=================" + this.$route.query.id)
          // this.tableData = [
          //   {baseInfo: false,
          //    classesname: '英语课',
          //    employee: '李教员',
          //    empltkjs: '1-2',
          //    classes: '教学一班',
          //    place: '场地一',
          //    class_sessions: "1-2",
          //   class_sessions_list: [{label: "1-2", value: "1-2"}],
          //   },
          //   {baseInfo: false,
          //    classesname: '拉拉',
          //    employee: '拉拉',
          //    empltkjs: '拉拉',
          //    classes: '拉拉',
          //    place: '拉拉',
          //   class_sessions: "2-2",
          //    class_sessions_list: [{label: "1-2", value: "1-2"},{label: "1-3", value: "1-2"}],
          //   },
          //   ] ;
          // console.log("==========督导信息============" + res.data.data)
        });
      });
    },
    sssa(item, index) {
      let newS = "";
      for (let key in item) {
        console.log('单选项', item);
        if (key.includes("checked")) {
          if (key != "checked" + index) {
            newS = key;
            item[newS] = false;
          }
        }
      }
      console.log('选中', index)
      item["checked" + index] = true;
      item.result = this.titles[index];
      // for (let i = 0; i < this.subTitleser.length; i++) {
      //   for (
      //     let j = 0;
      //     j < this.subTitleser[i].evaluateBatchNormList.length;
      //     j++
      //   ) {
      //     if(this.subTitleser[i].evaluateBatchNormList[j]['checked' + (i + 1)] == true){
      //       this.subTitleser[i].evaluateBatchNormList[j].result = this.titles[i + 1];
      //     }
      //     // if (this.subTitleser[i].evaluateBatchNormList[j].checked1 == true) {
      //     //   this.subTitleser[i].evaluateBatchNormList[j].result = "A";
      //     // } else if (
      //     //   this.subTitleser[i].evaluateBatchNormList[j].checked2 == true
      //     // ) {
      //     //   this.subTitleser[i].evaluateBatchNormList[j].result = "B";
      //     //   this.subTitleser[i].evaluateBatchNormList[j].checked1 == false
      //     // } else if (
      //     //   this.subTitleser[i].evaluateBatchNormList[j].checked3 == true
      //     // ) {
      //     //   this.subTitleser[i].evaluateBatchNormList[j].result = "C";
      //     // } else if (
      //     //   this.subTitleser[i].evaluateBatchNormList[j].checked4 == true
      //     // ) {
      //     //   this.subTitleser[i].evaluateBatchNormList[j].result = "D";
      //     // }
      //   }
      // }

      console.log(this.subTitleser);
    },

    srcAbcdList() {
      return new Promise((resolve) => {
        srcAbcd().then((res) => {
          console.log('评分信息', res.data.data.bzdj)
          this.titles = res.data.data.bzdj;
          this.pcid = res.data.data.pcid;
          this.userName = res.data.data.tckr;
          this.tckrzjh = res.data.data.tckrzjh;
          this.subTitleser = res.data.data.evaluateBatchNormVOList;
          localStorage.setItem("sekevalue", "A");
          // this.subTitleser.forEach(element => {
          //   element.evaluateBatchNormList.forEach(element,index => {
          //     let i = this.titles.indexOf(element.result);
          //     element['checked' + i] = false;
          //   })
          // });
          // this.subTitleser.map((item,i)=>{
          //   .map((each,j)=>{
          //     this.$set(each,'checked' + j,false)
          //     // this.$set(each,'checked1',false)
          //     // this.$set(each,'checked2',false)
          //     // this.$set(each,'checked3',false)
          //     // this.$set(each,'checked4',false)
          //   })
          // })

          for (let i = 0; i < this.subTitleser.length; i++) {
            let data = this.subTitleser[i]
            for (let j = 0; j < data.evaluateBatchNormList.length; j++) {
              let minData = data.evaluateBatchNormList[j]
              this.sssa(minData, 4)
            }
          }
          console.log('haha5555', this.subTitleser);
        });
      });
    },

    getFile() {
      this.fileName = this.$refs.upload.uploadFiles[0].raw;
      /* let file = event.target.files;
      this.tablelist.fileName = file[0].name;
      console.log(file[0].name);
      let form = new FormData();
      let id = this.tablelist.id;
      form.append("file", file[0]);
      form.append("id", id);
      let el = this;
      return new Promise(() => {
        getUpload(form).then((res) => {
          if (res.data.code === 200) {
            this.getdetail();
            el.$message({
              showClose: true,
              message: "上传成功",
              type: "success",
            });
          } else {
            el.$message({
              showClose: true,
              message: "上传失败，请重新上传",
              type: "error",
            });
          }
        });
      }); */
    },
    //提交按钮
    saveGrouper(type) {
      if (
        this.skxx.empltkjs === undefined ||
        this.skxx.empltkjs1 === undefined
      ) {
        this.$message.warning("听课节次不能为空！");
        return;
      }
      if (this.num == "") {
        this.$message({
          showClose: true,
          type: "warning",
          message: "评定分数不能为空！",
        });
        return;
      }
      if (localStorage.getItem("sekevalue") == "A") {
        if (this.num < 90) {
          this.$message({
            showClose: true,
            type: "warning",
            message: "请输入90-100的分数",
          });
          return;
        }
      }
      if (localStorage.getItem("sekevalue") == "B") {
        if (this.num < 80 || this.num > 90) {
          this.$message({
            showClose: true,
            type: "warning",
            message: "请输入80-90的分数",
          });
          return;
        }
      }
      if (localStorage.getItem("sekevalue") == "C") {
        if (this.num < 60 || this.num > 80) {
          this.$message({
            showClose: true,
            type: "warning",
            message: "请输入60-80的分数",
          });
          return;
        }
      }
      if (localStorage.getItem("sekevalue") == "D") {
        if (this.num < 1 || this.num > 60) {
          this.$message({
            showClose: true,
            type: "warning",
            message: "请输入1-60的分数",
          });
          return;
        }
      }
      let obj = {
        skrq: this.value1,
        skjyzjh: this.skjyzjh,
        skjy: this.skjyName,
        tckr: this.userName,
        tckrzjh: this.tckrzjh,
        kcmc: this.skxx.coursename,
        jxb: this.skxx.classes,
        cd: this.skxx.courseplace,
        tkjc: this.skxx.empltkjs + "-" + this.skxx.empltkjs1,
        pjdj: this.evaluation_grade,
        pdfs: this.num,
        zjpy: this.expert_reviews,
        evaluateBatchNormVOList: this.subTitleser,
        tjzt: type == 1?"已提交":"暂存",
        pcid: this.pcid,
        // termid: this.skxx.paikeInfo.xueqi,
        courseid: this.skxx.id,
        teacherid: this.teacherId,
      };
      let fd = new FormData();
      fd.append("file", this.fileName);
      if (this.fileName) {
        getUploadTrain('',fd).then((res) => {
          if (res.data.code == 200) {
            obj.pysmj = res.data.data;
            let result = null;
            result = saveGroup(obj);
            result.then((res) => {
              if (res.data.code == 200) {
                this.$message({ type: "success", message: "操作成功！" });
                // this.$refs.ruleForm.resetFields();
                if(this.$route.query.type && this.$route.query.type == 'teamA'){
                  this.$router.push({
                    path: "/teacher/appraisal/supervision", //要跳转的页面的路由
                  });
                } else {
                  this.$router.push({
                    path: "/admin/appraisal/manage", //要跳转的页面的路由
                  });
                }
              }
            });
          }
        });
      } else {
        let result = null;
        result = saveGroup(obj);
        result.then((res) => {
          if (res.data.code == 200) {
            this.$message({ type: "success", message: "操作成功！" });
            // this.$refs.ruleForm.resetFields();
            if(this.$route.query.type && this.$route.query.type == 'teamA'){
              this.$router.push({
                path: "/teacher/appraisal/supervision", //要跳转的页面的路由
              });
            } else {
              this.$router.push({
                path: "/admin/appraisal/manage", //要跳转的页面的路由
              });
            }
          }
        });
      }
    },
    //取消按钮
    cback(){
      if(this.$route.query.type && this.$route.query.type == 'teamA'){
        this.$router.push({
          path: "/teacher/appraisal/supervision", //要跳转的页面的路由
        });
      } else {
        this.$router.push({
          path: "/admin/appraisal/manage", //要跳转的页面的路由
        });
      }
    }
  },
};
</script>
<style lang="less" scoped>
.el-form-item--mini.el-form-item,
.el-form-item--small.el-form-item,
.el-form-item {
  margin-bottom: 0px;
}

.add-supervision-information-container {
  .evaluate-level {
    .el-input__inner {
      border: 1px solid rgba(2, 200, 108, 1);
      color: rgba(2, 200, 108, 1);
      background: rgba(241, 255, 248, 1);

      .el-icon-arrow-up:before {
        content: "\E6E1";
      }
    }

    .el-select .el-input.is-focus .el-input__inner {
      border-color: rgba(2, 200, 108, 1);
    }

    .el-select:focus .el-input__inner,
    .el-select:hover .el-input__inner {
      border-color: rgba(2, 200, 108, 1);
    }

    .el-input .el-select__caret {
      color: rgba(2, 200, 108, 1);
    }

    .el-select-dropdown__item.selected {
      color: rgba(2, 200, 108, 1);
    }

    .el-input.is-focus .el-input__inner {
      border-color: rgba(2, 200, 108, 1);
    }
  }

  .el-textarea__inner {
    resize: none;
  }

  .manual-entry-container {
    .el-dialog__body {
      >div {
        width: 1014px;
        border: 1px solid rgba(0, 76, 167, 0.8);
        border-radius: 6px;
        margin: 25px auto;

        >div {
          border-bottom: 1px solid rgba(0, 76, 167, 0.39);

          &:last-child {
            border-bottom: none;
          }

          >div {
            display: flex;

            >div {
              height: 96px;
              display: flex;
              align-items: center;
              justify-content: center;

              &:nth-child(1) {
                width: 220px;
                text-align: center;
                font-size: 16px;
                font-weight: bold;
                color: #004ca7;
                background: rgba(77, 129, 192, 0.1);
              }

              &:nth-child(2) {
                padding-left: 19px;
              }
            }
          }
        }
      }
    }

    .el-dialog__footer {
      padding-bottom: 43px;
    }

    .dialog-footer {
      >button {
        width: 87px;
        height: 36px;
        background: #fff6ef;
        border: 1px solid #f3b815;
        border-radius: 6px;
        background: rgba(255, 246, 239, 1);
        font-size: 18px;
        color: #f3b815;
        margin-right: 0px !important;
      }
    }
  }
}

.add-supervision-information-green-popper {
  .el-select-dropdown__item {
    color: rgba(2, 200, 108, 1);
  }

  .el-select-dropdown__item.selected {
    color: rgba(2, 200, 108, 1);
    font-weight: 700;
  }
}
</style>
<style scoped lang="less">
.add-supervision-information-container {
  .my-form {
    width: 1737px;

    border: 1px solid rgba(0, 76, 167, 0.8);
    margin: 57px auto 19px;

    .my-form-item {
      border-bottom: 1px solid rgba(0, 76, 167, 0.39);

      >div {
        display: table-cell;
        min-height: 54px;
        vertical-align: middle;
      }

      .my-form-item-label {
        font-size: 16px;
        font-weight: bold;
        color: #004ca7;
        background: rgba(77, 129, 192, 0.1);
        width: 239px;
        text-align: center;
      }

      .my-form-item-content {
        // width: 1497px;
        font-size: 14px;
        color: #004ca7;
        border-left: 1px solid rgba(0, 76, 167, 0.39);

        >ul {
          list-style: none;

          >li {
            >span:last-child {
              border-right: none;
            }

            >span {
              border-right: 1px solid rgba(0, 76, 167, 0.39);
            }
          }
        }
      }

      &:nth-child(1) {
        .my-form-item-content {
          >div {
            height: 69px;
            display: inline-block;
            vertical-align: middle;
            padding-top: 23px;

            &:nth-child(1) {
              width: 384px;
              padding-left: 30px;
              padding-top: 15px;
            }

            &:nth-child(2) {
              width: 240px;
              font-size: 16px;
              font-weight: bold;
              color: #004ca7;
              background: rgba(77, 129, 192, 0.1);
              text-align: center;
            }

            &:nth-child(3) {
              width: 303px;
              padding-top: 15px;

              >div {
                display: inline-block;

                &:nth-child(1) {
                  width: 110px;
                  height: 39px;
                  border: 1px solid #004ca7;
                  display: inline-block;
                  border-radius: 4px;
                  padding: 10px 0 0 34px;
                  margin: 0 37px 0 15px;
                }

                &:nth-child(2) {
                  width: 120px;
                  height: 27px;
                  background: #fff6ef;
                  border: 1px solid #f3b815;
                  border-radius: 4px;
                  padding: 1px 15px;
                  color: rgba(243, 184, 21, 1);
                  font-size: 16px;
                  cursor: pointer;

                  >img {
                    width: 15px;
                    height: 15px;
                    margin-right: 8px;
                    vertical-align: -2px;
                  }
                }
              }
            }

            &:nth-child(4) {
              width: 240px;
              font-size: 16px;
              font-weight: bold;
              color: #004ca7;
              background: rgba(77, 129, 192, 0.1);
              text-align: center;
            }

            &:nth-child(5) {
              // padding-left: 20px;
            }
          }
        }
      }

      &:nth-child(2) {
        .my-form-item-content {
          >div {
            height: 56px;
            vertical-align: middle;
            padding-top: 10px;
            padding-left: 30px;

            >span {
              font-size: 16px;
              font-weight: bold;
              line-height: 39px;
              margin-right: 46px;
              color: #004ca7;

              >span {
                font-weight: 400;
              }
            }
          }
        }
      }

      &:nth-child(3) {
        .my-form-item-content {
          >ul {
            list-style: none;

            >li {
              border-bottom: 1px solid rgba(0, 76, 167, 0.39);

              &:nth-child(1) {
                background: rgba(77, 129, 192, 0.1);

                >span {
                  font-weight: bold;
                }
              }

              &:last-child {
                border-bottom: none;
              }

              >span {
                display: inline-block;
                height: 55px;
                text-align: center;
                padding-top: 18px;
                width: 233px;
                vertical-align: middle;

                &:nth-child(1) {
                  width: 473px;
                }

                &:nth-child(2) {
                  // border-left: 1px solid rgba(0, 76, 167, 0.39);
                  // border-right: 1px solid rgba(0, 76, 167, 0.39);
                }

                &:nth-child(4) {
                  // border-left: 1px solid rgba(0, 76, 167, 0.39);
                  // border-right: 1px solid rgba(0, 76, 167, 0.39);
                }
              }
            }
          }
        }
      }

      &:nth-child(4) {
        .my-form-item-content {
          >div {
            height: 76px;
            display: inline-block;
            vertical-align: middle;
            padding-top: 23px;

            &:nth-child(1) {
              width: 630px;
              padding-left: 30px;
            }

            &:nth-child(2) {
              width: 240px;
              background: rgba(77, 129, 192, 0.1);
              border-left: 1px solid rgba(0, 76, 167, 0.39);
              border-right: 1px solid rgba(0, 76, 167, 0.39);
              text-align: center;
              font-size: 16px;
              font-weight: bold;
            }

            &:nth-child(3) {
              width: 625px;
              padding-left: 30px;
            }
          }
        }
      }

      &:nth-child(5) {
        .my-form-item-content {
          >div {
            height: 116px;
            display: inline-block;
            vertical-align: middle;
            padding-top: 23px;

            &:nth-child(1) {
              width: 630px;
              padding-left: 30px;
              padding-top: 9px;
            }

            &:nth-child(2) {
              width: 240px;
              background: rgba(77, 129, 192, 0.1);
              border-left: 1px solid rgba(0, 76, 167, 0.39);
              border-right: 1px solid rgba(0, 76, 167, 0.39);
              text-align: center;
              font-size: 16px;
              font-weight: bold;
              padding-top: 45px;
            }

            &:nth-child(3) {
              // width: 625px;
              padding-left: 30px;
              padding-top: 42px;

              >span {
                display: inline-block;
                background: #ebe6ff;
                border: 1px solid #5230e9;
                border-radius: 4px;
                font-size: 16px;
                font-weight: 400;
                color: #5230e9;
                padding: 3px 17px;
              }
            }
          }
        }
      }
    }
  }

  .button-group {
    cursor: pointer;
    width: 915px;
    margin: 30px auto;
    text-align: center;

    >div {
      display: inline-block;
      font-size: 18px;
      padding: 6px 22px;
      border-radius: 6px;

      &:nth-child(1) {
        color: rgba(81, 174, 246, 1);
        border: 1px solid rgba(81, 174, 246, 1);
        background: rgba(241, 248, 254, 1);
      }

      &:nth-child(2) {
        color: #f3b815;
        border: 1px solid #f3b815;
        background: #fff6ef;
        margin: 0 100px;
      }

      &:nth-child(3) {
        color: rgba(250, 83, 57, 1);
        border: 1px solid rgba(250, 83, 57, 1);
        background: rgba(255, 239, 239, 1);
      }
    }
  }
}
</style>

<style lang="less" scoped>
.el-form-item {
  ::v-deep .el-form-item__content {
    // position: absolute;
    margin-left: 900px;
    margin-top: -60px;
  }
}
</style>
